<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="类型名称" prop="drtypename">
        <el-input
          v-model="queryParams.drtypename"
          placeholder="请输入设备类型名称(中文)"
          clearable
          @keyup.enter.native="handleQuery"
          id="drtypename"
        />
      </el-form-item>
      <el-form-item label="类型名称" prop="drtypenameEN">
        <el-input
          v-model="queryParams.drtypenameEN"
          placeholder="请输入设备类型名称(英文)"
          clearable
          @keyup.enter.native="handleQuery"
          id="drtypenameEN"
        />
      </el-form-item>
      <el-form-item label="类型代码" prop="drTypeCode">
        <el-input
          v-model="queryParams.drTypeCode"
          placeholder="请输入设备类型代码"
          clearable
          @keyup.enter.native="handleQuery"
          id="drTypeCode"
        />
      </el-form-item>
      <el-form-item label="是否显示" prop="isshow">
        <el-select v-model="queryParams.isshow" placeholder="请选择是否显示" id="isshow" @change="handleQuery" clearable>
          <el-option
            v-for="dict in dict.type.sys_is_show"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="显示结构" prop="isdrtype">
        <el-select v-model="queryParams.isdrtype" placeholder="请选择是否显示结构图" id="isdrtype" @change="handleQuery" clearable>
          <el-option
            v-for="dict in dict.type.sys_is_show"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="自定义" prop="iscustomType">
        <el-select v-model="queryParams.iscustomType" placeholder="请选择是否是自定义类型" id="iscustomType" @change="handleQuery" clearable>
          <el-option
            v-for="dict in dict.type.sys_is_custom_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否能耗" prop="isenergy">
        <el-select v-model="queryParams.isenergy" placeholder="请选择是否能耗存储" id="isenergy" @change="handleQuery" clearable>
          <el-option
            v-for="dict in dict.type.sys_is_energy"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:drtypeinfoglobal:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-sort"
          size="mini"
          @click="toggleExpandAll"
        >展开/折叠</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:drtypeinfoglobal:export']"
        >导出</el-button>
      </el-col>
      <span> 所有项目共用一份统一的设备类型，在项目点表初始化时候使用 </span>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table
      v-if="refreshTable"
      v-loading="loading"
      :data="drtypeinfoglobalList"
      row-key="drtypeid"
      :default-expand-all="isExpandAll"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
    >
<!--      <el-table-column label="父设备类型ID" prop="parentId" />-->
<!--      <el-table-column label="祖级列表" align="center" prop="ancestors" />-->
      <el-table-column label="设备类型名称(中文)" prop="drtypename" />
      <el-table-column label="设备类型名称(英文)" align="center" prop="drtypenameEN" />
      <el-table-column label="设备类型代码" align="center" prop="drTypeCode" />
<!--      <el-table-column label="设备类型的图标ID" align="center" prop="drtypeiconid" />-->
      <el-table-column label="是否显示" align="center" prop="isshow">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_is_show" :value="scope.row.isshow"/>
        </template>
      </el-table-column>
      <el-table-column label="是否显示结构图" align="center" prop="isdrtype">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_is_show" :value="scope.row.isdrtype"/>
        </template>
      </el-table-column>
      <el-table-column label="是否是自定义类型" align="center" prop="iscustomType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_is_custom_type" :value="scope.row.iscustomType"/>
        </template>
      </el-table-column>
<!--      <el-table-column label="页面ID" align="center" prop="picid" />-->
      <el-table-column label="是否能耗存储" align="center" prop="isenergy">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_is_energy" :value="scope.row.isenergy"/>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:drtypeinfoglobal:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-plus"
            @click="handleAdd(scope.row)"
            v-hasPermi="['system:drtypeinfoglobal:add']"
          >新增</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:drtypeinfoglobal:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 添加或修改全局设备类型对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="父类型" prop="parentId">
              <treeselect v-model="form.parentId" :options="drtypeinfoOptions" :normalizer="normalizer" placeholder="请选择父设备类型ID" style="width: 217px"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="中文名称" prop="drtypename">
              <el-input v-model="form.drtypename" placeholder="请输入设备类型名称(中文)" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="英文名称" prop="drtypenameEN">
              <el-input v-model="form.drtypenameEN" placeholder="请输入设备类型名称(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="类型代码" prop="drTypeCode">
              <el-input v-model="form.drTypeCode" placeholder="请输入设备类型代码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="是否显示" prop="isshow">
              <el-select v-model="form.isshow" placeholder="请选择是否显示">
                <el-option
                  v-for="dict in dict.type.sys_is_show"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="显示结构" prop="isdrtype">
              <el-select v-model="form.isdrtype" placeholder="请选择是否显示结构图">
                <el-option
                  v-for="dict in dict.type.sys_is_show"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="自定义" prop="iscustomType">
              <el-select v-model="form.iscustomType" placeholder="请选择是否是自定义类型">
                <el-option
                  v-for="dict in dict.type.sys_is_custom_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="是否能耗" prop="isenergy">
              <el-select v-model="form.isenergy" placeholder="请选择是否能耗存储">
                <el-option
                  v-for="dict in dict.type.sys_is_energy"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

<!--        <el-form-item label="设备类型的图标ID" prop="drtypeiconid">
          <el-input v-model="form.drtypeiconid" placeholder="请输入设备类型的图标ID" />
        </el-form-item>-->
<!--        <el-form-item label="页面ID" prop="picid">
          <el-input v-model="form.picid" placeholder="请输入页面ID" />
        </el-form-item>-->

        <el-divider content-position="center">全局设备类型模板信息</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddGlobalDrTypeMode">添加(在列表底部添加)</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteGlobalDrTypeMode">删除</el-button>
          </el-col>
        </el-row>
        <el-table :data="globalDrTypeModeList" :row-class-name="rowGlobalDrTypeModeIndex" @selection-change="handleGlobalDrTypeModeSelectionChange" ref="globalDrTypeMode">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column label="序号" align="center" prop="index" width="50"/>
          <el-table-column label="寄存器名" prop="regName" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.regName" placeholder="请输入寄存器名" />
            </template>
          </el-table-column>
          <el-table-column label="单位" prop="regUnits" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.regUnits" placeholder="请输入单位" />
            </template>
          </el-table-column>
          <el-table-column label="排序" prop="regListshowlevel" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.regListshowlevel" placeholder="请输入显示顺序" />
            </template>
          </el-table-column>
          <el-table-column label="值类型" prop="regType" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.regType" placeholder="请选择值类型">
                <el-option
                  v-for="dict in dict.type.sys_value_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="读写类型" prop="regReadwrite" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.regReadwrite" placeholder="请选择读写">
                <el-option
                  v-for="dict in dict.type.sys_read_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="初始值" prop="tagValue" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.tagValue" placeholder="请输入初始值" />
            </template>
          </el-table-column>
          <el-table-column label="分组" prop="regGroupId" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.regGroupId" placeholder="变量分组" clearable>
                <el-option
                  v-for="group in groupOptions"
                  :key="group.id"
                  :label="group.groupName"
                  :value="group.id"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="数据回显" prop="regSub" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.regSub" placeholder="请选择数据回显" clearable>
                <el-option
                  v-for="item in subOptions"
                  :key="item.subid"
                  :label="item.subname"
                  :value="String(item.subid)"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="点位类型" prop="regDrshowtype" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.regDrshowtype" placeholder="请选择点位类型">
                <el-option
                  v-for="dict in dict.type.sys_reg_dr_show_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="是否列表显示" prop="islistshow" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.islistshow" placeholder="请选择列表显示">
                <el-option
                  v-for="dict in dict.type.sys_is_show"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
<!--          <el-table-column label="显示阀值" prop="regDrsub" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.regDrsub" placeholder="请输入显示阀值" />
            </template>
          </el-table-column>-->
          <el-table-column label="是否历史存储" prop="ishistory" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.ishistory" placeholder="请选择是否历史" clearable>
                <el-option
                  v-for="dict in dict.type.sys_is_custom_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="是否能耗" prop="isenergy" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.isenergy" placeholder="请选择是否能耗">
                <el-option
                  v-for="dict in dict.type.sys_is_energy"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="是否报警" prop="isalarm" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.isalarm" placeholder="请选择是否报警">
                <el-option
                  v-for="dict in dict.type.sys_is_alarm"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
<!--          <el-table-column label="报警类别" prop="alarmtype" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.alarmtype" placeholder="请选择报警类别">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="报警条件小值" prop="valueMin" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.valueMin" placeholder="请输入报警条件小值" />
            </template>
          </el-table-column>
          <el-table-column label="报警条件大值" prop="valueMax" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.valueMax" placeholder="请输入报警条件大值" />
            </template>
          </el-table-column>
          <el-table-column label="报警条件与或" prop="andOr" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.andOr" placeholder="请输入报警条件与或" />
            </template>
          </el-table-column>-->
          <el-table-column label="报警级别" prop="alarmLevel" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.alarmLevel" placeholder="报警等级(仅布尔变量)" clearable>
                <el-option
                  v-for="alarmLevel in alarmLevelOptions"
                  :key="alarmLevel.alarmtypelevel"
                  :label="alarmLevel.alarmtypeExpain"
                  :value="alarmLevel.alarmtypelevel"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="采集周期" prop="tagTime" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.tagTime" placeholder="请选择寄存器采集周期">
                <el-option
                  v-for="dict in dict.type.sys_data_save_time"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </template>
          </el-table-column>
<!--          <el-table-column label="颜色" prop="regcolor" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.regcolor" placeholder="请输入颜色" />
            </template>
          </el-table-column>-->
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listDrtypeinfoglobal, getDrtypeinfoglobal, delDrtypeinfoglobal, addDrtypeinfoglobal, updateDrtypeinfoglobal,getSubOptionSelect } from "@/api/system/drtypeinfoglobal";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {groupSelect} from "@/api/system/drtypemode";
import {alarmLevelSelect} from "@/api/system/qstag";

export default {
  name: "Drtypeinfoglobal",
  dicts: ['sys_reg_dr_show_type', 'sys_is_custom_type', 'sys_is_show', 'sys_is_energy', 'sys_read_type', 'sys_yes_no', 'sys_data_save_time', 'sys_is_alarm', 'sys_value_type'],
  components: {
    Treeselect
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 子表选中数据
      checkedGlobalDrTypeMode: [],
      // 显示搜索条件
      showSearch: true,
      // 全局设备类型表格数据
      drtypeinfoglobalList: [],
      // 全局设备类型模板表格数据
      globalDrTypeModeList: [],
      // 设备类型管理树选项
      drtypeinfoOptions: [],
      //变量分组
      groupOptions: undefined,
      //报警等级
      alarmLevelOptions: undefined,
      // 设备属性回显定义列表
      subOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否展开，默认全部展开
      isExpandAll: true,
      // 重新渲染表格状态
      refreshTable: true,
      // 查询参数
      queryParams: {
        drtypename: null,
        drtypenameEN: null,
        drTypeCode: null,
        isshow: null,
        isdrtype: null,
        iscustomType: null,
        isenergy: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getGroupSelect();
    this.getAlarmLevelSelect();
    this.getSubList();
  },
  methods: {
    /** 查询全局设备类型列表 */
    getList() {
      this.loading = true;
      listDrtypeinfoglobal(this.queryParams).then(response => {
        this.drtypeinfoglobalList = this.handleTree(response.data, "drtypeid", "parentId");
        this.loading = false;
      });
    },
    /** 查询字典类型列表 */
    getSubList() {
      getSubOptionSelect().then(response => {
        this.subOptions = response.data;
      });
    },
    /** 转换设备类型管理数据结构 */
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.drtypeid,
        label: node.drtypename,
        children: node.children
      };
    },
	  /** 查询设备类型管理下拉树结构 */
    getTreeselect() {
      listDrtypeinfoglobal().then(response => {
        this.drtypeinfoOptions = [];
        const data = { drtypeid: 0, drtypename: '顶级节点', children: [] };
        data.children = this.handleTree(response.data, "drtypeid", "parentId");
        this.drtypeinfoOptions.push(data);
      });
    },
    /** 查询报警等级类型 */
    getAlarmLevelSelect() {
      alarmLevelSelect().then(response => {
        this.alarmLevelOptions = response.data;
      });
    },
    /** 查询变量分组 */
    getGroupSelect() {
      groupSelect().then(response => {
        this.groupOptions = response.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        drtypeid: null,
        parentId: null,
        ancestors: null,
        drtypename: null,
        drtypenameEN: null,
        drTypeCode: null,
        drtypeiconid: null,
        isshow: null,
        isdrtype: null,
        iscustomType: null,
        picid: null,
        isenergy: null
      };
      this.globalDrTypeModeList = [];
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd(row) {
      this.reset();
      this.getTreeselect();
      if (row != null && row.drtypeid) {
        this.form.parentId = row.drtypeid;
      } else {
        this.form.parentId = 0;
      }
      this.open = true;
      this.title = "添加全局设备类型";
    },
    /** 展开/折叠操作 */
    toggleExpandAll() {
      this.refreshTable = false;
      this.isExpandAll = !this.isExpandAll;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.getTreeselect();
      if (row != null) {
        this.form.parentId = row.parentId;
      }
      getDrtypeinfoglobal(row.drtypeid).then(response => {
        this.form = response.data;
        this.globalDrTypeModeList = response.data.globalDrTypeModeList;
        this.open = true;
        this.title = "修改全局设备类型";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.globalDrTypeModeList = this.globalDrTypeModeList;
          if (this.form.drtypeid != null) {
            updateDrtypeinfoglobal(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addDrtypeinfoglobal(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$modal.confirm('是否确认删除全局设备类型编号为"' + row.drtypeid + '"的数据项？').then(function() {
        return delDrtypeinfoglobal(row.drtypeid);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
	/** 全局设备类型模板序号 */
    rowGlobalDrTypeModeIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 全局设备类型模板添加按钮操作 */
    handleAddGlobalDrTypeMode() {
      let obj = {};
      obj.regName = "";
      obj.regType = "";
      obj.regUnits = "";
      obj.regReadwrite = "";
      obj.tagValue = "";
      obj.regGroupId = "";
      obj.regListshowlevel = "";
      obj.regSub = "";
      obj.regDrshowtype = "";
      obj.regDrsub = "";
      obj.ishistory = "";
      obj.isenergy = "";
      obj.isalarm = "";
      obj.alarmtype = "";
      obj.valueMin = "";
      obj.valueMax = "";
      obj.andOr = "";
      obj.alarmLevel = "";
      obj.islistshow = "";
      obj.tagTime = "";
      obj.regcolor = "";
      this.globalDrTypeModeList.push(obj);
    },
    /** 全局设备类型模板删除按钮操作 */
    handleDeleteGlobalDrTypeMode() {
      if (this.checkedGlobalDrTypeMode.length === 0) {
        this.$modal.msgError("请先选择要删除的全局设备类型模板数据");
      } else {
        const globalDrTypeModeList = this.globalDrTypeModeList;
        const checkedGlobalDrTypeMode = this.checkedGlobalDrTypeMode;
        this.globalDrTypeModeList = globalDrTypeModeList.filter(function(item) {
          return checkedGlobalDrTypeMode.indexOf(item.index) === -1
        });
      }
    },
    /** 复选框选中数据 */
    handleGlobalDrTypeModeSelectionChange(selection) {
      this.checkedGlobalDrTypeMode = selection.map(item => item.index)
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/drtypeinfoglobal/export', {
        ...this.queryParams
      }, `全局设备类型_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
